package com.ybu.service.impl;

import com.ybu.common.ServiceCode;
import com.ybu.common.ServiceException;
import com.ybu.mapper.ProductMapper;
import com.ybu.pojo.vo.ProductVO;
import com.ybu.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class ProductServiceImpl implements ProductService {
   @Autowired
   private ProductMapper productMapper;

    @Override
    public List<ProductVO> getNewProductList() {
        List<ProductVO> newProductList = productMapper.getNewProductList();
        if(newProductList == null || newProductList.isEmpty()){
            throw  new ServiceException(ServiceCode.ERR_NOT_FOUND,"没有新商品");
        }
        return newProductList;
    }

}
